<template>
  <div>
    <MyProduct
      v-for="item in list"
      :key="item.id"
      :title="item.proname"
      :money="item.proprice"
      :val="msg"
      @kan="hKan"
      :proId="item.id"
    />
  </div>
</template>

<script>
import MyProduct from "./components/MyProduct.vue";
export default {
  components: {
    MyProduct
  },
  data() {
    return {
      list: [
        { id: 1, proname: "超级无敌椰子鸡儿", proprice: 69 },
        { id: 2, proname: "超级无敌棒棒鸡儿", proprice: 59 },
        { id: 3, proname: "超级无敌钵钵鸡儿", proprice: 49 }
      ],
      msg: "很好吃的"
    };
  },

  mounted() {},

  methods: {
    hKan(num) {
      // console.log(1);
      const str = this.list.find(item => (item.id = num));
      // console.log(str);
      str.proprice -= 2;
    }
  }
};
</script>

<style>
</style>